package com.yuan.dao.subscribe.impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.orm.ibatis.SqlMapClientTemplate;

import com.yuan.dao.subscribe.SubscribeDao;
import com.yuan.subscribe.Subscribe;

/**
 * 订阅邮件的实现类
 * 
 * @author Beni
 * 
 */
public class SubscribeDaoImpl extends SqlMapClientTemplate implements
		SubscribeDao {

	private static final Logger logger = Logger
			.getLogger(SubscribeDaoImpl.class);

	public void save(Subscribe subscribe) throws SQLException {
		try {
			this.insert("Subscribe.save", subscribe);
		} catch (Exception e) {
			logger.error("Subscribe入库失败", e);
			throw new SQLException();
		}
	}

	public List<Subscribe> readEffect() throws SQLException {
		try {
			return this.queryForList("Subscribe.readEffect");
		} catch (Exception e) {
			logger.error("查询失败", e);
			throw new SQLException();
		}
	}

}
